use utf8;
package GlavFinans::Schema::Result::User;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

=head1 NAME

GlavFinans::Schema::Result::User

=cut

use strict;
use warnings;

use base 'DBIx::Class::Core';

=head1 TABLE: C<users>

=cut

__PACKAGE__->table("users");

=head1 ACCESSORS

=head2 id

  data_type: 'integer'
  is_auto_increment: 1
  is_nullable: 0
  sequence: 'users_id_seq'

=head2 guid

  data_type: 'uuid'
  default_value: uuid_generate_v4()
  is_nullable: 0
  size: 16

=head2 relname

  data_type: 'text'
  is_nullable: 0
  original: {data_type => "varchar"}

=head2 name

  data_type: 'text'
  is_nullable: 0
  original: {data_type => "varchar"}

=head2 created

  data_type: 'timestamp'
  default_value: current_timestamp
  is_nullable: 0
  original: {default_value => \"now()"}

=head2 updated

  data_type: 'timestamp'
  default_value: current_timestamp
  is_nullable: 0
  original: {default_value => \"now()"}

=head2 password

  data_type: 'text'
  is_nullable: 0
  original: {data_type => "varchar"}

=head2 email

  data_type: 'text'
  is_nullable: 0
  original: {data_type => "varchar"}

=head2 phone

  data_type: 'text'
  is_nullable: 0
  original: {data_type => "varchar"}

=head2 firstname

  data_type: 'text'
  is_nullable: 1
  original: {data_type => "varchar"}

=head2 middlename

  data_type: 'text'
  is_nullable: 1
  original: {data_type => "varchar"}

=head2 lastname

  data_type: 'text'
  is_nullable: 1
  original: {data_type => "varchar"}

=head2 active

  data_type: 'boolean'
  default_value: false
  is_nullable: 1

=head2 role

  data_type: 'text'
  is_foreign_key: 1
  is_nullable: 1
  original: {data_type => "varchar"}

=cut

__PACKAGE__->add_columns(
  "id",
  {
    data_type         => "integer",
    is_auto_increment => 1,
    is_nullable       => 0,
    sequence          => "users_id_seq",
  },
  "guid",
  {
    data_type => "uuid",
    default_value => \"uuid_generate_v4()",
    is_nullable => 0,
    size => 16,
  },
  "relname",
  {
    data_type   => "text",
    is_nullable => 0,
    original    => { data_type => "varchar" },
  },
  "name",
  {
    data_type   => "text",
    is_nullable => 0,
    original    => { data_type => "varchar" },
  },
  "created",
  {
    data_type     => "timestamp",
    default_value => \"current_timestamp",
    is_nullable   => 0,
    original      => { default_value => \"now()" },
  },
  "updated",
  {
    data_type     => "timestamp",
    default_value => \"current_timestamp",
    is_nullable   => 0,
    original      => { default_value => \"now()" },
  },
  "password",
  {
    data_type   => "text",
    is_nullable => 0,
    original    => { data_type => "varchar" },
  },
  "email",
  {
    data_type   => "text",
    is_nullable => 0,
    original    => { data_type => "varchar" },
  },
  "phone",
  {
    data_type   => "text",
    is_nullable => 0,
    original    => { data_type => "varchar" },
  },
  "firstname",
  {
    data_type   => "text",
    is_nullable => 1,
    original    => { data_type => "varchar" },
  },
  "middlename",
  {
    data_type   => "text",
    is_nullable => 1,
    original    => { data_type => "varchar" },
  },
  "lastname",
  {
    data_type   => "text",
    is_nullable => 1,
    original    => { data_type => "varchar" },
  },
  "active",
  { data_type => "boolean", default_value => \"false", is_nullable => 1 },
  "role",
  {
    data_type      => "text",
    is_foreign_key => 1,
    is_nullable    => 1,
    original       => { data_type => "varchar" },
  },
);

=head1 PRIMARY KEY

=over 4

=item * L</id>

=back

=cut

__PACKAGE__->set_primary_key("id");

=head1 UNIQUE CONSTRAINTS

=head2 C<user_email_uniq_idx>

=over 4

=item * L</email>

=back

=cut

__PACKAGE__->add_unique_constraint("user_email_uniq_idx", ["email"]);

=head2 C<user_name_uniq_idx>

=over 4

=item * L</name>

=back

=cut

__PACKAGE__->add_unique_constraint("user_name_uniq_idx", ["name"]);

=head1 RELATIONS

=head2 role

Type: belongs_to

Related object: L<GlavFinans::Schema::Result::Role>

=cut

__PACKAGE__->belongs_to(
  "role",
  "GlavFinans::Schema::Result::Role",
  { name => "role" },
  {
    is_deferrable => 1,
    join_type     => "LEFT",
    on_delete     => "CASCADE",
    on_update     => "CASCADE",
  },
);

=head2 user_groups

Type: has_many

Related object: L<GlavFinans::Schema::Result::UserGroup>

=cut

__PACKAGE__->has_many(
  "user_groups",
  "GlavFinans::Schema::Result::UserGroup",
  { "foreign.src" => "self.id" },
  { cascade_copy => 0, cascade_delete => 0 },
);


# Created by DBIx::Class::Schema::Loader v0.07025 @ 2012-07-31 13:04:13
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Hezz3vtwRuZvrUvPs48+5w


# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;
